import frontRequest from "@/utils/http/frontRequest.js";

/**
 * 获取游戏走马灯数据
 * @param length
 * @param sort
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const gameCarouselGetAPI = ({length = 8, sort = 1}) => {
    return frontRequest.get('/game/carousel', {
        params: {
            length,
            sort
        }
    })
}

/**
 * 获取游戏新品推荐数据
 * @param length
 * @param sort
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const gameNewGetAPI = ({length = 4, sort = 2}) => {
    return frontRequest.get('/game/new', {
        params: {
            length,
            sort
        }
    })
}

/**
 * 获取折扣游戏数据
 * @param length
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const gameDiscountGetAPI = ({length = 4}) => {
    return frontRequest.get('/game/discount', {
        params: {
            length
        }
    })
}

/**
 * 获取推荐游戏数据
 * @param length
 * @param sort
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const gameRecommendGetAPI = ({length = 8, sort = 0}) => {
    return frontRequest.get('/game/recommend', {
        params: {
            length,
            sort
        }
    })
}

/**
 * 获取游戏分页列表数据
 * @param params
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const gamePageListGetAPI = (params) => {
    return frontRequest.get('/game/page', {
        params
    })
}

/**
 * 获取通用走马灯数据
 * @param params
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const gameCommonCarouselGetAPI = (params) => {
    return frontRequest.get('/game/common/carousel', {
        params
    })
}

/**
 * 通过categoryId获取游戏数据
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const gamesByCategoryIdGetAPI = (category) => {
    return frontRequest.get('/game/bycategory', {
        params: {category}
    })
}

// 根据id获取游戏数据
export const gameGetAPI = (id) => {
    return frontRequest.get(`/game/${id}`)
}
